package com.zzyl.nursing.controller.member;

import java.util.List;

import com.zzyl.common.core.domain.R;
import com.zzyl.nursing.dto.NursingProjectDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zzyl.common.annotation.Log;
import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.AjaxResult;
import com.zzyl.common.enums.BusinessType;
import com.zzyl.nursing.domain.NursingProject;
import com.zzyl.nursing.service.INursingProjectService;
import com.zzyl.common.core.page.TableDataInfo;

/**
 * 护理项目--服务端Controller
 * 
 * @author ck
 * @date 2025-06-09
 */
@Api(tags = "护理项目--服务端管理")
@RestController
@RequestMapping("/member/orders/project")
public class MemberNursingProjectController extends BaseController
{
    @Autowired
    private INursingProjectService nursingProjectService;

    /**
     * 查询护理项目--服务端列表
     */
    @ApiOperation("查询护理项目--服务端列表")
//    @PreAuthorize("@ss.hasPermi('member:project:list')")
    @GetMapping("/page")
    public TableDataInfo<List<NursingProject>> list(@ApiParam("护理项目--服务端查询条件") NursingProjectDto dto)
    {
        return nursingProjectService.MemberSelectNursingProjectList(dto);
    }
//    @ApiOperation("查询护理项目--服务端列表")
////    @PreAuthorize("@ss.hasPermi('member:orders/project:list')")
//    @GetMapping("/page")
//    public TableDataInfo<List<NursingProject>> list(@ApiParam("护理项目--服务端查询条件") NursingProject nursingProject)
//    {
//        startPage();
//        List<NursingProject> list = nursingProjectService.selectNursingProjectList(nursingProject);
//        return getDataTable(list);
//    }

    /**
     * 导出护理项目--服务端列表
     */
//    @ApiOperation("导出护理项目--服务端列表")
////    @PreAuthorize("@ss.hasPermi('member:orders/project:export')")
//    @Log(title = "护理项目--服务端", businessType = BusinessType.EXPORT)
//    @PostMapping("/export")
//    public void export(@ApiParam(value = "护理项目--服务端查询条件") HttpServletResponse response, NursingProject nursingProject)
//    {
//        List<NursingProject> list = nursingProjectService.selectNursingProjectList(nursingProject);
//        ExcelUtil<NursingProject> util = new ExcelUtil<NursingProject>(NursingProject.class);
//        util.exportExcel(response, list, "护理项目--服务端数据");
//    }

    /**
     * 获取护理项目--服务端详细信息
     */
    @ApiOperation("获取护理项目--服务端详细信息")
//    @PreAuthorize("@ss.hasPermi('member:orders/project:query')")
    @GetMapping(value = "/{id}")
    public R<NursingProject> getInfo(@ApiParam("护理项目--服务端ID") @PathVariable("id") Long id)
    {
        return R.ok(nursingProjectService.selectNursingProjectById(id));
    }

    /**
     * 新增护理项目--服务端
     */
    @ApiOperation("新增护理项目--服务端")
//    @PreAuthorize("@ss.hasPermi('member:orders/project:add')")
    @Log(title = "护理项目--服务端", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@ApiParam("护理项目--服务端信息") @RequestBody NursingProject nursingProject)
    {
        return toAjax(nursingProjectService.insertNursingProject(nursingProject));
    }

    /**
     * 修改护理项目--服务端
     */
    @ApiOperation("修改护理项目--服务端")
//    @PreAuthorize("@ss.hasPermi('member:orders/project:edit')")
    @Log(title = "护理项目--服务端", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@ApiParam("护理项目--服务端信息") @RequestBody NursingProject nursingProject)
    {
        return toAjax(nursingProjectService.updateNursingProject(nursingProject));
    }

    /**
     * 删除护理项目--服务端
     */
    @ApiOperation("删除护理项目--服务端")
    @PreAuthorize("@ss.hasPermi('member:orders/project:remove')")
    @Log(title = "护理项目--服务端", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@ApiParam("护理项目--服务端ID数组") @PathVariable Long[] ids)
    {
        return toAjax(nursingProjectService.deleteNursingProjectByIds(ids));
    }
}
